package com.example.controller;

import com.example.service.PhoneService;
import com.fasterxml.jackson.core.JsonProcessingException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/phone")
public class PhoneController {
    @Autowired
    private PhoneService phoneService;

    @GetMapping("/{phone}")
    @ResponseBody
    public Object queryByPhone(@PathVariable String phone) throws JsonProcessingException {
        return phoneService.queryByPhone(phone); // 对象
    }
}
